package com.linwen.javase.desgin_pattern.BigTalkDesignPattenJAVACode._06原型模式._1基本代码;

//原型类
abstract class Prototype implements Cloneable {
    private String id;

    public Prototype(String id){
        this.id=id;
    }

    public String getID(){
        return this.id;
    }

    //原型模式的关键就是有这样一个clone方法
    public Object clone(){
        Object object = null;
        try {
            object = super.clone();
        } catch(CloneNotSupportedException exception){
            System.err.println("Clone异常。");
        }
        return object;
    }
}
